package com.xz.courseschedule.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xz.courseschedule.entity.Classes;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ClassesMapper extends BaseMapper<Classes> {
    /**
     * 获得班级的人数
     */
    @Select("select size from classes where class_no = #{classNo}")
    int selectStuSize(@Param("classNo") String classNo);

    /**
     * 获得班级编号
     */
    @Select("select class_no from classes")
    List<Classes> selectClassNo();

    /**
     * 修改班级信息
     */
    @Update("update classes set class_name = #{className},size = #{size} where class_no = #{classNo}")
    void updateClasses(String classNo,@Param("className") String className,@Param("size") int size);

}
